package com.gzbugu.bugusys.action;

import javax.annotation.Resource;

import org.apache.struts2.ServletActionContext;
import org.springframework.stereotype.Controller;

import com.gzbugu.bugusys.service.impl.LoginService;
import com.opensymphony.xwork2.ActionSupport;

@Controller
public class LoginAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	private String passport;
	private String password;
	
	@Resource(name="loginService")
	private LoginService service;

	public String execute() {
		if(service.login(passport,password)) {
			password = "";
			ServletActionContext.getRequest().getSession().setAttribute("passport",passport);
			return SUCCESS;
		}
		return INPUT;
	}

	public String getPassport() {
		return passport;
	}

	public void setPassport(String passport) {
		this.passport = passport;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}
